package com.example.understand_compose1.fet_viewpager2.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.example.understand_compose1.fet_xuiusage.ui.dashboard.DashboardFragment
import com.example.understand_compose1.fet_xuiusage.ui.home.HomeFragment
import com.example.understand_compose1.fet_xuiusage.ui.notifications.NotificationsFragment

// TODO: 必须要为viewpager2实现Adapter
class VPGAdapter(fragmentActivity: FragmentActivity):FragmentStateAdapter(fragmentActivity) {
    override fun getItemCount(): Int {
        return 3 // 假设3个Fragment
    }

    override fun createFragment(position: Int): Fragment {
        return when (position) {
            0->HomeFragment()
            1->DashboardFragment()
            else -> NotificationsFragment()
        }
    }

}